﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace rbdesign.Model
{
    class ModelTopic
    {
        public static SortedList<int,string> fGetTopicsList()
        {
            try
            {
                DataTable dt = ModelCRUD.Select("SELECT id,subject FROM tblTopic");

                SortedList<int, string> listTopicNames = new SortedList<int, string>();

                foreach (DataRow drRow in dt.Rows)
                {
                    listTopicNames.Add(int.Parse(drRow["id"].ToString()), (string)drRow["subject"]);
                }

                return listTopicNames;
            }
            catch (Exception e)
            {
                throw e;
            }
        }
    }
}
